home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cpptutor.arc / EMPLOYEE.CPP < prev    next >
Text File  |  1991-04-28  |  2KB  |  71 lines

  1.                                      // Chapter 11 - Program 5
  2. #include "iostream.h"
  3. #include "person.hpp"
  4. #include "supervsr.hpp"
  5.  
  6. person *staff[10];
  7.  
  8. main()
  9. {
  10. supervisor *suppt;
  11. programmer *progpt;
  12. secretary *secpt;
  13.  
  14.    cout << "XYZ Staff -- note salary is monthly.\n\n";
  15.  
  16.    suppt = new supervisor;
  17.    suppt->init_data("Big John", 5100, "President");
  18.    staff[0] = suppt;
  19.  
  20.    progpt = new programmer;
  21.    progpt->init_data("Joe Hacker", 3500, "debugger", "Pascal");
  22.    staff[1] = progpt;
  23.  
  24.    progpt = new programmer;
  25.    progpt->init_data("OOP Wizard", 7700, "senior analyst", "C++");
  26.    staff[2] = progpt;
  27.  
  28.    secpt = new secretary;
  29.    secpt->init_data("Tillie Typer", 2200, 1, 85);
  30.    staff[3] = secpt;
  31.  
  32.    suppt = new supervisor;
  33.    suppt->init_data("Tom talker", 5430, "Sales manager");
  34.    staff[4] = suppt;
  35.  
  36.    progpt = new programmer;
  37.    progpt->init_data("Dave Debugger", 5725, "code maintainer", 
  38.                                                 "assembly language");
  39.    staff[5] = progpt;
  40.  
  41.    for (int index = 0 ; index < 6 ; index++ )
  42.       staff[index]->display();
  43.  
  44.    cout << "End of employee list.\n";
  45. }
  46.  
  47.  
  48.  
  49.  
  50. // Result of execution
  51.  
  52. // XYZ Staff -- note salary is monthly.
  53. //
  54. // Supervisor --> Big John's salary is 5100 and is the President.
  55. //
  56. // Programmer --> Joe Hacker's salary is 3500 and is debugger.
  57. //                Joe Hacker's specialty is Pascal.
  58. //
  59. // Programmer --> OOP Wizard's salary is 7700 and is senior analyst.
  60. //                OOP Wizard's specialty is C++.
  61. //
  62. // Secretary ---> Tillie Typer's salary is 2200.
  63. //                Tillie typer types 85 per minute and can take shorthand.
  64. //
  65. // Supervisor --> Tom Talker's salary is 5430 and is the sales manager.
  66. //
  67. // Programmer --> Dave Debugger's salary is 5725 and is code maintainer.
  68. //                Dave Debugger's specialty is assembly language.
  69. //
  70. // End of employee list.
  71.